import { DotLoading } from "antd-mobile";
import React from "react";
import TenantItem from "./tenant-item";

class TenantList extends React.Component {
  constructor(props) {
    super(props);

    this.state = {};
  }
  render() {
    const {
      tenantList,
      stopPropagation,
      isShowLoading,
      getTenantList,
    } = this.props;

    if (isShowLoading) {
      return <DotLoading color="primary" />;
    }

    if (!tenantList?.length) {
      return <p className="baby-love-admin-tenant-list-empty">暂无数据</p>;
    }

    return (
      <ul className="baby-love-admin-tenant-list-content">
        {tenantList.map((tenantItem) => (
          <li
            key={tenantItem.tenantCode}
            className="baby-love-admin-tenant-list-item"
          >
            <TenantItem
              tenantItem={tenantItem}
              stopPropagation={stopPropagation}
              getTenantList={getTenantList}
            />
          </li>
        ))}
      </ul>
    );
  }
}

export default TenantList;
